    <!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>塞纳皇宫-网站后台管理系统</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="icon" href="/static/admin/img/logo.png" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico"> <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/static/admin/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="/static/admin/css/animate.css" rel="stylesheet">
    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/static/admin/css/plugins/switchery/switchery.css" rel="stylesheet">
    <style>
        tr td i {padding-right: 10px;}
        #div1{
            width:62px;
            height: 32px;
            border-radius: 50px;
            position: relative;
        }
        #div2{
            width: 26px;
            height: 26px;
            border-radius: 48px;
            position: absolute;
            background: white;
            /*box-shadow: 0px 2px 4px rgba(0,0,0,0.4);*/
        }
        .open1{
            background: #24b7e5;
        }
        .open2{
            top: 3px;
            right: 3px;
        }
        .close1{
            background: #cdcdcd;
            border-left: transparent;
        }
        .close2{
            left: 4px;
            top: 3px;
        }

    </style>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>服务优势</h5>
                       <div class="ibox-tools">

                        </div>
                    </div>
                    <div class="ibox-content">

                      <div class="">
                            <a onclick="fnClickAddRow();" href="javascript:void(0);" class="btn btn-primary ">添加优势</a>
                            <a onclick="fnClickAddClass();" href="javascript:void(0);" class="btn  " style="margin-left:10px;border: 1px #333 solid;color:#000;">编辑分类</a>
                      </div>

                        <div class="row" style="z-index: 3;width: 600px;height: 50px;position: relative; ">
                            <form action="/admin.php/aos/cg" method="post">
                                <div style="z-index: 3;width: 160px; position: absolute;left: 15px; top: 10px;  ">
                                    <select type="search" class="form-control select—sou" name="is_recom">
                                        <option  value="">按推荐状态</option>
                                        <option {if isset($_POST['is_recom']) && $_POST['is_recom']=="0"} selected="selected"{/if} value="0">未推荐</option>
                                        <option  {if isset($_POST['is_recom']) && $_POST['is_recom']=="1"} selected="selected"{/if} value="1">已推荐</option>
                                    </select>
                                </div>
                                <div style="z-index: 3;width: 140px; position: absolute;left:230px; top: 10px;  ">
                                    <select type="search" class="form-control select—sou" name="class_id">
                                        <option  value="">分类检索</option>
                                        {volist name="data.info" id="v"}
                                        <option  value="{$v.class_id}">{$v.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                                <div class="sousuo" style="z-index: 3;width: 100px; position: absolute;left: 400px; top: 10px;  ">
                                    <button type="submit" class="btn btn-primary " >搜索</button>
                                </div>
                            </form>
                        </div>

                        <table class="table table-striped table-bordered table-hover " id="treeTable">
                            <thead>
                                <tr>
                                    <th>排序</th>
                                    <th>名称</th>
                                    <th>栏目分类</th>
                                    <th>主图</th>
                                    <th>所属范围</th>
                                     <th>首页推荐</th>
                                    <th>显示状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>

                            {volist name="data.list" id="v"}

                                <tr class="gradeX" id="{$v.id}"   >
                                    <td><input style="width: 40px;-webkit-appearance: none;"  name="sort_{$v.id}"  onblur="ChangeSort({$v.id})" type="text" value="{$v.sort}"></td>
                                    <td><a title="点击查看" target="_blank" href="/index.php/index/details?id={$v.id}.html">{$v.title}</a></td>
                                    <td class="center">{volist name="data.info" id="c"}{if $v.class_id==$c.class_id}{$c.name}{/if}{/volist}</td>
                                    <td><img width="60" height="40px;" src="{$v.main_img}"></td>
                                    <td class="center">{if $v.Scenery ==1}内景{elseif $v.Scenery==2}外景{else}{/if}</td>
                                    <td>
                                        {if $v.is_recom==1}
                                        <label class="open1" onclick="tastra({$v.id})" id="div1">
                                            <label  class="open2"   id="div2"></label>
                                        </label>
                                        {else}
                                        <label class="close1" onclick="tastra({$v.id})" id="div1">
                                            <label class="close2"   id="div2"></label>
                                        </label>
                                        {/if}
                                    </td>
                                    <td class="center">{if $v.is_show ==1}已显示{else}未显示{/if}</td>
                                    <td class="center">
                                        <a href="javascript:;" onclick="edit({$v.id})">编辑</a>&nbsp;&nbsp;&nbsp;
                                     <a href="javascript:;" onclick="del(this,{$v.id})">删除</a></td>
                                    </td>
                                </tr>
                            {/volist}


                            </tbody>

                        </table>

                    </div>
                </div>
            </div>
        </div>


    <!-- 全局js -->
    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <!--<script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>-->

        <script src="/static/admin/js/plugins/switchery/switchery.js"></script>

    <!--<script src="/static/admin/js/plugins/jeditable/jquery.jeditable.js"></script>-->

    <!-- Data Tables -->
    <script src="/static/admin/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="/static/admin/js/plugins/dataTables/dataTables.bootstrap.js"></script>

    <!-- 自定义js -->
    <script src="/static/admin/js/content.js?v=1.0.0"></script>

    <script src="/static/admin/layer/layer.js"></script>
    <script src="/static/admin/treeTable/jquery.treeTable.js" type="text/javascript"></script>
    <!-- Page-Level Scripts -->
    <script>

        var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));

        elems.forEach(function(html) {
            var switchery = new Switchery(html);
        });



        function fnClickAddRow() {
            window.location.href="/admin.php/aos/add_cg";


        }
        function fnClickAddClass() {
            window.location.href="/admin.php/aos/vclass";


        }
        //推荐状态
        function tastra(id) {
            var div2=document.getElementById("div2");
            var div1=document.getElementById("div1");
            $.post("/admin.php/aos/start",{id:id},function(e){
                if(1 == e.code){
                    layer.msg(e.msg);
                    div1.className=(div1.className=="close1")?"open1":"close1";
                    div2.className=(div2.className=="close2")?"open2":"close2";
                    window.location.reload();
                }else{
                    alyer.msg(e.msg);
                    return false;
                }
            })
        }
        //编辑
        function edit(id){
            window.location.href="/admin.php/aos/edit_cg?id="+id;
        }

        //删除
        function del(obj,id){
            layer.confirm('确认要删除吗？',function(){
                $.post("/admin.php/aos/cgdel",{id:id},function(e){
                    if(1==e.code){
                        layer.msg(e.msg);
                        $(obj).parents("tr").remove();
                    }else{
                        layer.msg(e.msg);
                    }
                 },'json')

            });
        }
        //排序
        function ChangeSort(id){
            var  sort_name = 'sort_'+id+'';
            var sort = $("input[name='"+sort_name+"']").val();
            if(isNaN(sort)){
                layer.msg('必须是数字');
                return false;
            }
            $.post("/admin.php/aos/ChangecgSort",{id:id,sort:sort},function(e){
                if(1==e.code){
                    layer.msg(e.msg);
                    window.location.reload();
                }else{
                    layer.msg(e.msg);
                    return false;
                }
            },'json')
        }

        var option = {
            theme:'vsStyle',
            expandLevel : 10,
            path : '/static/admin/treeTable/'
        };
        $('#treeTable').treeTable(option);
    </script>

    
    

</body>

</html>
